main.c

#include"book.h"
int main()
{
    int choice;
    struct address_book type_book;
    Book_init(&type_book);//初始化
    while (1)
    {
        Menu();
        printf("请选择操作>");
        scanf("%d", &choice);
        switch (choice) {
        case 0:
            SaveContact(&type_book);//将通讯录数据保存到文件里
            Destrory_Book(&type_book);//通讯录的销毁
            printf("Good Bye!\n");
            return 0;
        case 1:
            CheckCapacity(&type_book);//插入前检查是否需要扩容
            Book_add(&type_book);
            break;
        case 2:
            Book_fine(&type_book);
            break;
        case 3:
            Book_mod(&type_book);
            break;
        case 4:
            Book_del(&type_book);
            break;
        case 5:
            Book_clear(&type_book);
            break;
        case 6:
            Book_sort(&type_book);
            break;
        case 7:
            Book_print(&type_book);
            break;
        default:
            printf("选择错误!\n");
            break;
        }
    }
    return 0;
}